package com.deanlib.cabinet.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.deanlib.plantern.Plantern;

/**
 * @Created by Dean
 * @Date 2023/9/5
 */
public class NetworkManagerExt {

    public static boolean isNetworkConn() {
        ConnectivityManager mConnectivityManager = (ConnectivityManager) Plantern.getAppContext()
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        @SuppressLint("MissingPermission") NetworkInfo mNetworkInfo = mConnectivityManager
                .getActiveNetworkInfo();
        if (mNetworkInfo != null) {
            return NetworkInfo.State.CONNECTED == mNetworkInfo.getState();
        }
        return false;
    }
}
